package com.jxl_dyw.UI;

import javax.swing.*;
import java.awt.*;
import java.io.IOException;

public class MainUI extends JFrame {
    //选项卡面板
    private JTabbedPane tabbedPane;
    private EmpUI empUI;
    private DeptUI deptUI;

    public MainUI() throws IOException {
        setTitle("企业人事管理系统");
        //点击窗口关闭按钮，关闭程序
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(1200, 800);

        // 创建顶部栏
        JPanel topPanel = new JPanel();
        topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
        JLabel titleLabel = new JLabel("员工信息管理系统");
        topPanel.add(titleLabel);

        // 创建选项卡面板
        tabbedPane = new JTabbedPane();
        empUI = new EmpUI();
        deptUI = new DeptUI();
        tabbedPane.addTab("员工管理", empUI);
        tabbedPane.addTab("部门管理", deptUI);

        // 设置布局
        setLayout(new BorderLayout());
        add(topPanel, BorderLayout.NORTH);
        add(tabbedPane, BorderLayout.CENTER);
        //使其居中
        setLocationRelativeTo(null);
        setVisible(true);
    }

}